﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="Expires" CONTENT="0">
    <meta http-equiv="Cache-Control" CONTENT="no-cache">
    <meta http-equiv="Pragma" CONTENT="no-cache">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="description" content="">
    <meta name="keywords" content="0">
    <title>浪潮智联</title>
    <link rel="stylesheet" href="${s.base}/mobile/css/style.css">
    <link rel="stylesheet" href="${s.base}/js/layui/css/layui.css" media="all" />
    <script type="text/javascript" src="${s.base}/mobile/js/jquery.min.js"></script>
    <script type="text/javascript" src="${s.base}/jslayui/layui.js"></script>
    <style type="text/css">

              body {
	           
                        background:#0099cc;
                        width:100%; 
                        height:100%; 
                   
                    }

        #head{width: 96%;height: 80px;margin-left: 2%;}
        #head ul{width: 100%;}
        #head ul li{float: left;line-height: 80px;}
        #head ul .title{width: 50%; text-align: left;font-size: 30px;color:#ffffff;font-weight: bold;}
        #head ul .btn{width: 50%; text-align: right;line-height: 80px;}
        #head ul .btn input{float: right; margin-right: 5%; width: auto; height: 36px; margin-top: 22px;font-size: 18px;color:#ffffff;}
        #content{width: 92%;margin-left: 4%;margin-top: 40px;}
        #content ul{width: 100%;}
        #content ul li{width: 100%; text-align: center;clear: both;}
        #content ul .content_title{width: 30%; text-align: right;float: left;margin: 10px 0px;}
        #content ul .content_value{width: 60%; text-align: left;float: left; margin: 10px 0px;}
        #content ul .content_input{width: 180px;line-height: 34px;font-size: 15px;border-radius: 5px; padding-left: 10px;margin-left: 5px;}
        #content ul .content_select{width: 195px;line-height: 30px;font-size: 15px;border-radius: 5px; padding-left: 10px;margin-left: 5px;}
        .line40{line-height:40px}
        .line80{line-height:80px}
        .line140{line-height:140px}
        .font1{font-size: 18px;color: #ffffff;}
        .font2{font-size: 20px;color: #ffffff;}
        .font3{font-size: 14px;}
        .select{line-height: 30px;font-size: 15px;border-radius: 5px; padding-left: 10px;margin-left: 5px;}
        .input{line-height: 34px;font-size: 15px;border-radius: 5px; padding-left: 10px;margin-left: 5px;width: 60px;}
        .text_align_left{text-align: left;}
        .text_align_right{text-align: right;}
        .blank{color: #ffffff;}
        .red{color:#FF0000;}
        .org{color:#F77303;}
        .gree{color:#9AFC02;}
        .margin-left1{margin-left: 40px;}
    </style>
</head>

<body style="max-width:640px;">

<!--
<div style="position:absolute; width:100%; height:100%; z-index:-1">
    <img style="position:fixed;" src="${s.base}/mobile/img/head-bg.png" height="100%" width="100%" />
</div>
-->

<div id="head">
    <ul>
        <li class="title">
            浪潮智联
        </li>
        <li class="btn">
            <input type="button" onClick="window.location.href='${s.base}/inspur/index/${openid}'" class="layui-btn layui-btn-radius layui-btn-normal" value="返回"/>
        </li>
    </ul>
</div>
<div id="content">
    <input type="hidden" id="openid" value="${openid}">
    <ul>

        <li class="line40">
            <div class="font2 content_title line40">
                设备类型:
            </div>
            <div class="content_value">
                <select class="content_select" id="productTypeId">
                    <#list productTypeList as productType>
                        <option  <#if productType.id == type >selected</#if> value="${productType.id}">${productType.name}</option>
                    </#list>
                </select>
            </div>
        </li>

        <li class="line40">
            <div class="font2 content_title line40">
                设&nbsp;&nbsp;备&nbsp;&nbsp;ID:
            </div>
            <div class="content_value">
                <input type="text" maxlength="20" name="deviceId" id="deviceId" value="${deviceId}"  placeholder="请输入设备ID"  class="content_input">
            </div>
        </li>
        <li class="line40">
            <div class="font2 content_title line40">
                设备名称:
            </div>
            <div class="content_value">
                <input type="text" name="name" maxlength="10" id="name" value="${name}" placeholder="请给您的设备起一个名称"  class="content_input">
            </div>
        </li>
        <li class="line80">
            <input type="button" value="下一步" onclick="addProduct()" name="title"  	class="layui-btn"/>
        </li>
    </ul>

</div>
<script type="text/javascript">
    function addProduct() {
        var openid=$("#openid").val();
        var name=$("#name").val();
        var deviceId=$("#deviceId").val();
        var productTypeId=$("#productTypeId").val();
        if(deviceId==""||deviceId==null){
            alert("请先填写设备ID");
            return false;
        }
        if(name==""||name==null){
            alert("请先填设备名称");
            return false;
        }


        $.ajax({
            type: "POST",
            url: "/inspur/addProduct/"+openid,
            data: {"openid":openid,"name":name,"deviceId":deviceId,"productTypeId":productTypeId},
            success: function(result){
                if(1==result.returnInfo.state){
                    window.location.href='/phone/addDesc/'+openid;
                }else{
                    alert(result.returnInfo.errorMsg);
                }
            },
            error: function(result){
                alert(result);
            }
        });
    }
</script>
</body>

</html>
